#include "common.h"

#ifndef ISR_H
#define	ISR_H

#define IRQ0 32
#define IRQ1 33
#define IRQ2 34
#define IRQ3 35
#define IRQ4 36
#define IRQ5 37
#define IRQ6 38
#define IRQ7 39
#define IRQ8 40
#define IRQ9 41
#define IRQ10 42
#define IRQ11 43
#define IRQ12 44
#define IRQ13 45
#define IRQ14 46
#define IRQ15 47

typedef struct registers
{
	uint32_t real_esp; // puseado para poder recuperar el puntero al stack
			   // justo antes de llamar al manejador de interrupcion.
	uint32_t ds;
	uint32_t edi, esi, ebp, esp, ebx, edx, ecx, eax; // pusha pushs.
	uint32_t int_no, err_code;
	uint32_t eip, cs, eflags; // processor automatic pushs.
} __attribute__((packed)) registers_t;

typedef struct
{
	registers_t normal_regs;
	uint32_t esp;
	uint32_t ss;
} __attribute__((packed)) extended_registers_t;

typedef uint32_t (*isr_t)(registers_t*);
void register_interrupt_handler(uint8_t n, isr_t handler);

#endif //ISR_H
